unit Unit3;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, IniFiles, ExtCtrls;

type
  TForm3 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Label2: TLabel;
    Edit2: TEdit;
    Label3: TLabel;
    Edit3: TEdit;
    Label4: TLabel;
    Edit4: TEdit;
    Label5: TLabel;
    Edit5: TEdit;
    Label6: TLabel;
    Edit6: TEdit;
    BitBtn1: TBitBtn;
    Panel1: TPanel;
    GroupBox1: TGroupBox;
    ComboBox1: TComboBox;
    ComboBox2: TComboBox;
    Label7: TLabel;
    Label8: TLabel;
    procedure BitBtn1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

uses dnip;

{$R *.dfm}

procedure TForm3.BitBtn1Click(Sender: TObject);
begin
  if FileExists(ExtractFilePath(Application.ExeName) + dnip.ConfigFileName) then begin
    iniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + ConfigFileName);
    iniFile.WriteString('FTP', 'host', Form3.Edit1.Text);
    iniFile.WriteString('FTP', 'port', Form3.Edit2.Text);
    iniFile.WriteString('FTP', 'user', Form3.Edit3.Text);
    iniFile.WriteString('FTP', 'pass', Form3.Edit4.Text);
    iniFile.WriteString('FTP', 'dir', Form3.Edit5.Text);
    iniFile.WriteString('FTP', 'prefix', Form3.Edit6.Text);
    iniFile.WriteString('FTP', 'hour', Form3.ComboBox1.Text);
    iniFile.WriteString('FTP', 'min', Form3.ComboBox2.Text);
  end;
  host := Form3.Edit1.Text;
  port := Form3.Edit2.Text;
  userftp := Form3.Edit3.Text;
  pass := Form3.Edit4.Text;
  dir := Form3.Edit5.Text;
  prefix := Form3.Edit6.Text;
  hour := Form3.ComboBox1.Text;
  min := Form3.ComboBox2.Text;
  iniFile.Free;
  Form1.Timer1.Enabled := true;
  form3.Close;
end;

procedure TForm3.FormCreate(Sender: TObject);
begin
  iniFile := TIniFile.Create(ExtractFilePath(Application.ExeName) + ConfigFileName);
  Form3.Edit1.Text := iniFile.ReadString('FTP', 'host', host);
  Form3.Edit2.Text := iniFile.ReadString('FTP', 'port', port);
  Form3.Edit3.Text := iniFile.ReadString('FTP', 'user', userftp);
  Form3.Edit4.Text := iniFile.ReadString('FTP', 'pass', pass);
  Form3.Edit5.Text := iniFile.ReadString('FTP', 'dir', dir);
  Form3.Edit6.Text := iniFile.ReadString('FTP', 'prefix', prefix);
  Form3.ComboBox1.Text := iniFile.ReadString('FTP', 'hour', hour);
  Form3.ComboBox2.Text := iniFile.ReadString('FTP', 'min', min);
  iniFile.Free;
end;

end.
